
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 <meta name="author" content="2cwebvn" />
 <link rel="stylesheet" type="text/css" href="CSS/Style.css">
 <link rel="stylesheet" type="text/css" href="CSS/tab-view.css" />
<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="localization/messages_vi.js"></script>
 
 <?php
 $HangSXX = $_POST['HangSX'];
 $Mang = $_POST['Mang'];
 $KD = $_POST['KieuDang'];
 $KT = $_POST['KichThuoc'];
 $TL = $_POST['TrongLuong'];
 $MH = $_POST['ManHinh'];
 $DPG = $_POST['DoPhanGiai'];
 $TB = $_POST['ThongBao'];
 $R = $_POST['Rung'];
 $TN = $_POST['LoaiTheNho'];
 $BNT = $_POST['BoNhoTrong'];
 $SMS = $_POST['TinNhan'];
 $GPRS = $_POST['GPRS'];
 $EDGE = $_POST['EDGE'];
 $HT3G = $_POST['HoTro3G'];
 $TD = $_POST['TrinhDuyet'];
 $Blue = $_POST['Bluetooth'];
 $W = $_POST['Wifi'];
 $USB = $_POST['CongUSB'];
 $Ca = $_POST['Camera'];
 $Mau = $_POST['Mau'];
 $HDH = $_POST['HeDieuHanh'];
 $Pin = $_POST['Pin'];
 $TGDT = $_POST['ThoiGianDamThoai'];
 $TGC = $_POST['ThoiGianCho'];
 
 
 $sql = "";
mysql_connect("localhost","root","") or die ("ket noi khong thanh cong") ;
		 mysql_select_db("dtdd")or die ("khong tim thay csdl");
		 $sql = "select * from sanpham where masp = any (select MaSP from tskt";
		
if($HangSXX != 0 || $Mang != 0 || $KD != 0 || $KT != 0 ||$TL != 0 || $MH != 0 || $DPG != 0 ||$TB != 0 || $R != 0 || $TN != 0 || $BNT != 0 || $SMS != 0 || $GPRS != 0 || $EDGE != 0 || $HT3G != 0 || $TD != 0 || $Blue != 0 || $W != 0 || $USB != 0 || $Ca != 0 || $Mau != 0 || $HDH != 0 || $Pin != 0 || $TGDT != 0 || $TGC != 0)
{
		$sql = $sql." where 1 ";
		
}
if($HangSXX != 0)
{
	$sql = $sql." and MaCT = '$HangSXX' ";
}
if($Mang != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$Mang') "; 	
}
if($KD != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$KD') ";
}
if($KT != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$KT') ";
}

if($TL != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$TL') ";
}
if($MH != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$MH') ";
}

if($DPG != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$DPG') ";
}
if($TB != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$TB') ";
}
if($R != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$R') ";
}
if($TN != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$TN') ";
}
if($TN != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$TN') ";
}
if($BNT != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$BNT') ";
}
if($SMS != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$SMS') ";
}
if($GPRS != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$GPRS') ";
}
if($EDGE != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$EDGE') ";
}
if($HT3G != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$HT3G') ";
}
if($TD != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$TD') ";
}
if($Blue != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$Blue') ";
}
if($W != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$W') ";
}
if($USB != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$USB') ";
}
if($Ca != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$Ca') ";
}
if($Mau != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$Mau') ";
}
if($HDH != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$HDH') ";
}
if($Pin != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$Pin') ";
}
if($TGDT != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$TGDT') ";
}
if($TGC != 0)
{
	$sql = $sql."and MaSP in (select MaSP from tskt where MaCT = '$TGC') ";
}
$sql = $sql.")";
$sqls = "";
$sqls = mysql_query($sql);
$x=0;
$rowx = "";
?>

 <table class="show" width="97%" border="0" align="center" >
        <tr align="center">
        <?php 
while($rowx = mysql_fetch_array($sqls))
		 {
			$x+=1;
		 
		?>
		<td  class="show">
		  
		    <?php echo "<font color='#000' size='2px'><label class='tendt' ><strong><u><p><a href='detail.php?madt=$rowx[0]'> $rowx[1] </strong></label></a></p></u></font>";?>
	      
		  <p><br/>
	      <?php echo "<a href='detail.php?madt=$rowx[0]'><img src ='$rowx[4]' width ='70' height ='95'></a>"?></p>
		  <br/>
		    <font color="#FF0000" size="3px"><label class="gia"><strong><?php echo "". number_format($rowx[3],0) ."đ";?>
	        </strong></label></font>
            
		 </td>
		 
		 <?php
		 if($x ==3)
		 {
			 $x = 0;
			 ?>
             </tr>
			 <tr align="center">
         <?php
        }
	
		} 
		 ?>
        </table> 
